//在面上绘制一个圆

#version 460
#extension GL_ARB_separate_shader_objects : enable
#extension GL_ARB_shading_language_420pack : enable



layout (location = 0) out vec4 outColor;
layout (location = 1) out vec2 outCenter;
layout (location = 2) out float outRadius;

layout (push_constant) uniform SCirclePushConstants
{
   vec4 Color;
   vec2 Position; //圆心的位置, 以屏幕坐标为单位
   float Radius; //圆的半径，以屏幕坐标为单位
   float Z; //z order of widget
} PushConstants;

const vec2 Vertices[4] = vec2[4](
   vec2(-1.0f, -1.0f),
   vec2(1.0f, -1.0f),
   vec2(-1.0f, 1.0f),
   vec2(1.0f, 1.0f)
);


void main() 
{
   gl_Position = vec4(Vertices[gl_VertexIndex], PushConstants.Z, 1.0f);
   outColor = PushConstants.Color;
   outCenter = PushConstants.Position 
      + vec2(0.5f, 0.5f);//因为gl_fragCoord坐标是 像素索引+0.5，所以这里也要+0.5
   outRadius = PushConstants.Radius;
}